package hottargui.standard;

import hottargui.framework.BoardStrategy;
import hottargui.framework.GameData;
import hottargui.framework.PlayerColor;
import hottargui.framework.Tile;
import hottargui.framework.TileType;

import java.util.List;

public class StandardBoardStrategy implements BoardStrategy {

	public void setupBoard(GameData gameData) {
		List<Tile> boardConf = gameData.getBoardConfiguration();

		boardConf.clear();

		boardConf.add(new StandardTile(TileType.Settlement, PlayerColor.Red, 0, 0));
		boardConf.add(new StandardTile(TileType.Erg, PlayerColor.None, 0, 1));
		boardConf.add(new StandardTile(TileType.Oasis, PlayerColor.None, 0, 2));
		boardConf.add(new StandardTile(TileType.Reg, PlayerColor.None, 0, 3));
		boardConf.add(new StandardTile(TileType.Oasis, PlayerColor.None, 0, 4));
		boardConf.add(new StandardTile(TileType.Feshfesh, PlayerColor.None, 0, 5));
		boardConf.add(new StandardTile(TileType.Settlement, PlayerColor.Green, 0, 6));

		boardConf.add(new StandardTile(TileType.Erg, PlayerColor.None, 1, 0));
		boardConf.add(new StandardTile(TileType.Oasis, PlayerColor.None, 1, 1));
		boardConf.add(new StandardTile(TileType.Feshfesh, PlayerColor.None, 1, 2));
		boardConf.add(new StandardTile(TileType.Erg, PlayerColor.None, 1, 3));
		boardConf.add(new StandardTile(TileType.Feshfesh, PlayerColor.None, 1, 4));
		boardConf.add(new StandardTile(TileType.Reg, PlayerColor.None, 1, 5));
		boardConf.add(new StandardTile(TileType.Reg, PlayerColor.None, 1, 6));

		boardConf.add(new StandardTile(TileType.Oasis, PlayerColor.None, 2, 0));
		boardConf.add(new StandardTile(TileType.Saltlake, PlayerColor.None, 2, 1));
		boardConf.add(new StandardTile(TileType.Feshfesh, PlayerColor.None, 2, 2));
		boardConf.add(new StandardTile(TileType.Oasis, PlayerColor.None, 2, 3));
		boardConf.add(new StandardTile(TileType.Reg, PlayerColor.None, 2, 4));
		boardConf.add(new StandardTile(TileType.Feshfesh, PlayerColor.None, 2, 5));
		boardConf.add(new StandardTile(TileType.Reg, PlayerColor.None, 2, 6));

		boardConf.add(new StandardTile(TileType.Saltlake, PlayerColor.None, 3, 0));
		boardConf.add(new StandardTile(TileType.Reg, PlayerColor.None, 3, 1));
		boardConf.add(new StandardTile(TileType.Saltlake, PlayerColor.None, 3, 2));
		boardConf.add(new StandardTile(TileType.Saltmine, PlayerColor.None, 3, 3));
		boardConf.add(new StandardTile(TileType.Erg, PlayerColor.None, 3, 4));
		boardConf.add(new StandardTile(TileType.Feshfesh, PlayerColor.None, 3, 5));
		boardConf.add(new StandardTile(TileType.Mountain, PlayerColor.None, 3, 6));

		boardConf.add(new StandardTile(TileType.Mountain, PlayerColor.None, 4, 0));
		boardConf.add(new StandardTile(TileType.Erg, PlayerColor.None, 4, 1));
		boardConf.add(new StandardTile(TileType.Saltlake, PlayerColor.None, 4, 2));
		boardConf.add(new StandardTile(TileType.Erg, PlayerColor.None, 4, 3));
		boardConf.add(new StandardTile(TileType.Mountain, PlayerColor.None, 4, 4));
		boardConf.add(new StandardTile(TileType.Reg, PlayerColor.None, 4, 5));
		boardConf.add(new StandardTile(TileType.Feshfesh, PlayerColor.None, 4, 6));

		boardConf.add(new StandardTile(TileType.Oasis, PlayerColor.None, 5, 0));
		boardConf.add(new StandardTile(TileType.Reg, PlayerColor.None, 5, 1));
		boardConf.add(new StandardTile(TileType.Reg, PlayerColor.None, 5, 2));
		boardConf.add(new StandardTile(TileType.Erg, PlayerColor.None, 5, 3));
		boardConf.add(new StandardTile(TileType.Reg, PlayerColor.None, 5, 4));
		boardConf.add(new StandardTile(TileType.Erg, PlayerColor.None, 5, 5));
		boardConf.add(new StandardTile(TileType.Mountain, PlayerColor.None, 5, 6));

		boardConf.add(new StandardTile(TileType.Settlement, PlayerColor.Blue, 6, 0));
		boardConf.add(new StandardTile(TileType.Erg, PlayerColor.None, 6, 1));
		boardConf.add(new StandardTile(TileType.Reg, PlayerColor.None, 6, 2));
		boardConf.add(new StandardTile(TileType.Feshfesh, PlayerColor.None, 6, 3));
		boardConf.add(new StandardTile(TileType.Erg, PlayerColor.None, 6, 4));
		boardConf.add(new StandardTile(TileType.Erg, PlayerColor.None, 6, 5));
		boardConf.add(new StandardTile(TileType.Settlement, PlayerColor.Yellow, 6, 6));

		// corner tiles
		Tile ul = gameData.getTile(0, 0);
		ul.setOwnerColor(PlayerColor.Red);
		ul.setUnitCount(10);

		Tile ur = gameData.getTile(0, 6);
		ur.setOwnerColor(PlayerColor.Green);
		ur.setUnitCount(10);

		Tile ll = gameData.getTile(6, 0);
		ll.setOwnerColor(PlayerColor.Blue);
		ll.setUnitCount(10);

		Tile lr = gameData.getTile(6, 6);
		lr.setOwnerColor(PlayerColor.Yellow);
		lr.setUnitCount(10);

		/*
		 * Left here for future code archaeologists...
		 * 
		 * // Red tile immediately under red settlement has 7 units Tile redTile =
		 * gameData.getTile(1, 0); redTile.setOwnerColor(PlayerColor.Red);
		 * redTile.setUnitCount(7);
		 *  // Red tile on (2,3) for adjacency testing Tile adjTile =
		 * gameData.getTile(2, 3); adjTile.setOwnerColor(PlayerColor.Red);
		 * adjTile.setUnitCount(10);
		 *  // Red tile on (3,1) for saltlake testing Tile saltLake =
		 * gameData.getTile(3, 1); saltLake.setOwnerColor(PlayerColor.Red);
		 * saltLake.setUnitCount(10);
		 *  // Red tile for attacking Tile redAttack = gameData.getTile(1, 4);
		 * redAttack.setOwnerColor(PlayerColor.Red); redAttack.setUnitCount(10);
		 *  // Green tile for losing battle Tile greenLose = gameData.getTile(2,
		 * 5); greenLose.setOwnerColor(PlayerColor.Green);
		 * greenLose.setUnitCount(5);
		 *  // Green tile for tied battle Tile greenTie = gameData.getTile(1,
		 * 5); greenTie.setOwnerColor(PlayerColor.Green);
		 * greenTie.setUnitCount(10);
		 *  // Green tile for successful defense Tile greenWin =
		 * gameData.getTile(0, 5); greenWin.setOwnerColor(PlayerColor.Green);
		 * greenWin.setUnitCount(13);
		 *  // Extra tiles for revenue Tile yellowRev = gameData.getTile(5, 6);
		 * yellowRev.setOwnerColor(PlayerColor.Yellow);
		 * 
		 * Tile blueRev = gameData.getTile(5, 0);
		 * blueRev.setOwnerColor(PlayerColor.Blue);
		 * 
		 * blueRev = gameData.getTile(4, 1);
		 * blueRev.setOwnerColor(PlayerColor.Blue);
		 */

	}
}
